<template>
	<div class="addCustomer">
		<el-divider content-position="left">
			<el-link type="primary">客户基本资料</el-link>
		</el-divider>
		<el-form :model="ruleForm" :rules="rules" ref="ruleForm" label-width="140px" class="demo-ruleForm"
			:disabled="type=='查看'">
			<el-row>
				<el-col :span="8">
					<el-form-item name="客户编号" :label="computeInputBox('customerNo','label')"
						:prop="computeInputBox('customerNo','isInput')" v-if="computeInputBox('customerNo','show')">
						<el-input class="lz-el-input" v-model="ruleForm.customerNo"
							:disabled="computeInputBox('customerNo','disabled')" :size="size" :maxlength="20"></el-input>
					</el-form-item>
					<el-form-item name="客户简称" :label="computeInputBox('customerCname','label')"
						:prop="computeInputBox('customerCname','isInput')"
						v-if="computeInputBox('customerCname','show')">
						<el-input class="lz-el-input" v-model="ruleForm.customerCname"
							:disabled="computeInputBox('customerCname','disabled')" :size="size" :maxlength="50"></el-input>
					</el-form-item>
					<el-form-item name="客户全称" :label="computeInputBox('customerEname','label')"
						:prop="computeInputBox('customerEname','isInput')"
						v-if="computeInputBox('customerEname','show')">
						<el-input class="lz-el-input" v-model="ruleForm.customerEname"
							:disabled="computeInputBox('customerEname','disabled')" :size="size" :maxlength="50"></el-input>
					</el-form-item>
					<el-form-item name="经营范围" :label="computeInputBox('manageRange','label')"
						:prop="computeInputBox('manageRange','isInput')" v-if="computeInputBox('manageRange','show')">
						<el-input class="lz-el-input" v-model="ruleForm.manageRange"
							:disabled="computeInputBox('manageRange','disabled')" :size="size" :maxlength="200"></el-input>
					</el-form-item>
				</el-col>
				<el-col :span="8">
					<el-form-item name="公司性质" :label="computeInputBox('companyKind','label')"
						:prop="computeInputBox('companyKind','isInput')" v-if="computeInputBox('companyKind','show')">
						<el-select v-model="ruleForm.companyKind" placeholder="请选择" :size="size" clearable
							class="lz-el-select" :disabled="computeInputBox('companyKind','disabled')">
							<el-option v-for="item in companykindList" :key="item.value" :label="item.label"
								:value="item.value"></el-option>
						</el-select>
					</el-form-item>
					<el-form-item name="公司税号" :label="computeInputBox('companyTax','label')"
						:prop="computeInputBox('companyTax','isInput')" v-if="computeInputBox('companyTax','show')">
						<el-input class="lz-el-input" v-model="ruleForm.companyTax"
							:disabled="computeInputBox('companyTax','disabled')" :size="size" :maxlength="50"></el-input>
					</el-form-item>
					<el-form-item name="注册资金" :label="computeInputBox('registerMoney','label')"
						:prop="computeInputBox('registerMoney','isInput')"
						v-if="computeInputBox('registerMoney','show')">
						<el-input class="lz-el-input" v-model="ruleForm.registerMoney"
							:disabled="computeInputBox('registerMoney','disabled')" :size="size" :maxlength="20"></el-input>
					</el-form-item>
				</el-col>
				<el-col :span="8">
					<el-form-item name="第一联系人" :label="computeInputBox('firstContactName','label')"
						:prop="computeInputBox('firstContactName','isInput')"
						v-if="computeInputBox('firstContactName','show')">
						<el-input class="lz-el-input" v-model="ruleForm.firstContactName"
							:disabled="computeInputBox('firstContactName','disabled')" :size="size" :maxlength="20"></el-input>
					</el-form-item>
					<el-form-item name="第一联系电话" :label="computeInputBox('firstPhone','label')"
						:prop="computeInputBox('firstPhone','isInput','checkLandline')" v-if="computeInputBox('firstPhone','show')">
						<el-input class="lz-el-input" v-model="ruleForm.firstPhone"
							:disabled="computeInputBox('firstPhone','disabled')" :size="size" :maxlength="20"></el-input>
					</el-form-item>
					<el-form-item name="邮箱" :label="computeInputBox('email','label')"
						:prop="computeInputBox('email','isInput','checkEmail')" v-if="computeInputBox('email','show')">
						<el-input class="lz-el-input" v-model="ruleForm.email"
							:disabled="computeInputBox('email','disabled')" :size="size"  :maxlength="30"></el-input>
					</el-form-item>
				</el-col>
			</el-row>
			<el-row>
				<el-col :span="16">
					<el-form-item name="地址" :label="computeInputBox('address','label')"
						:prop="computeInputBox('address','isInput')" v-if="computeInputBox('address','show')">
						<el-input v-model="ruleForm.address" :disabled="computeInputBox('address','disabled')"
							:size="size"  :maxlength="50"></el-input>
					</el-form-item>
				</el-col>
			</el-row>
			<el-divider content-position="left">
				<el-link type="primary">送货及报价</el-link>
			</el-divider>
			<el-row>
				<el-col :span="8">
					<el-form-item name="供应商编号" :label="computeInputBox('supplierNo','label')"
						:prop="computeInputBox('supplierNo','isInput')" v-if="computeInputBox('supplierNo','show')">
						<div style="display: flex;width: 200px;">
							<el-input @focus="focusFn" v-model="ruleForm.supplierNo" :size="size"
								suffix-icon="el-icon-arrow-down" style="width: 120px;margin-right: 5px;"></el-input>
							<el-input :value="ruleForm.supplierCname" :size="size" disabled></el-input>
						</div>
					</el-form-item>
					<el-form-item name="出货单格式" :label="computeInputBox('saleNoFormat','label')"
						:prop="computeInputBox('saleNoFormat','isInput')" v-if="computeInputBox('saleNoFormat','show')">
						<el-select v-model="ruleForm.saleNoFormat" placeholder="请选择" :size="size" clearable
							class="lz-el-select" :disabled="computeInputBox('saleNoFormat','disabled')">
							<el-option v-for="item in saleNoFormatList" :key="item.id" :label="item.printName"
								:value="item.printNo"></el-option>
						</el-select>
					</el-form-item>
				</el-col>
				<el-col :span="8">
					<el-form-item name="报价单格式" :label="computeInputBox('quotationNoFormat','label')"
						:prop="computeInputBox('quotationNoFormat','isInput')"
						v-if="computeInputBox('quotationNoFormat','show')">
						<el-select v-model="ruleForm.quotationNoFormat" placeholder="请选择" :size="size" clearable
							class="lz-el-select" :disabled="computeInputBox('quotationNoFormat','disabled')">
							<el-option v-for="item in quotationNoFormatList" :key="item.id" :label="item.printName"
								:value="item.printNo"></el-option>
						</el-select>
					</el-form-item>
					<el-form-item name="报价单单号" :label="computeInputBox('quotationBeginNo','label')"
						:prop="computeInputBox('quotationBeginNo','isInput')"
						v-if="computeInputBox('quotationBeginNo','show')">
						<el-input class="lz-el-input" v-model="ruleForm.quotationBeginNo"
							:disabled="computeInputBox('quotationBeginNo','disabled')" :size="size" :maxlength="20"></el-input>
					</el-form-item>
				</el-col>
				<el-col :span="8">
					<el-form-item name="销售送货单号编号" :label="computeInputBox('saleBusinessBeginNo','label')"
						:prop="computeInputBox('saleBusinessBeginNo','isInput')"
						v-if="computeInputBox('saleBusinessBeginNo','show')">
						<el-input class="lz-el-input" v-model="ruleForm.saleBusinessBeginNo"
							:disabled="computeInputBox('saleBusinessBeginNo','disabled')" :size="size" :maxlength="2"></el-input>
					</el-form-item>
					<el-form-item name="零星送货单号编号" :label="computeInputBox('littleBusinessBeginNo','label')"
						:prop="computeInputBox('littleBusinessBeginNo','isInput')"
						v-if="computeInputBox('littleBusinessBeginNo','show')">
						<el-input class="lz-el-input" v-model="ruleForm.littleBusinessBeginNo"
							:disabled="computeInputBox('littleBusinessBeginNo','disabled')" :size="size" :maxlength="2"></el-input>
					</el-form-item>
				</el-col>
			</el-row>
			<el-row>
				<el-col :span="16">
					<el-form-item name="送货地址" :label="computeInputBox('shippingAddress','label')"
						:prop="computeInputBox('shippingAddress','isInput')"
						v-if="computeInputBox('shippingAddress','show')">
						<el-input v-model="ruleForm.shippingAddress"
							:disabled="computeInputBox('shippingAddress','disabled')" :size="size" :maxlength="50"></el-input>
					</el-form-item>
				</el-col>
			</el-row>

			<el-divider content-position="left">
				<el-link type="primary">财务资料</el-link>
			</el-divider>
			<el-row>
				<el-col :span="8">
					<el-form-item name="结算类型编号" :label="computeInputBox('settleNo','label')"
						:prop="computeInputBox('settleNo','isInput')" v-if="computeInputBox('settleNo','show')">
						<el-select v-model="ruleForm.settleNo" placeholder="请选择" :size="size" clearable
							class="lz-el-select" :disabled="computeInputBox('settleNo','disabled')">
							<el-option v-for="item in settleNoList" :key="item.id" :label="item.settleName"
								:value="item.settleNo"></el-option>
						</el-select>
					</el-form-item>
					<el-form-item name="付款类型编号" :label="computeInputBox('paymentNo','label')"
						:prop="computeInputBox('paymentNo','isInput')" v-if="computeInputBox('paymentNo','show')">
						<el-select v-model="ruleForm.paymentNo" placeholder="请选择" :size="size" clearable
							class="lz-el-select" :disabled="computeInputBox('paymentNo','disabled')">
							<el-option v-for="item in paymentNoList" :key="item.id" :label="item.payName"
								:value="item.payNo"></el-option>
						</el-select>
					</el-form-item>
					<el-form-item name="币别" :label="computeInputBox('coin','label')"
						:prop="computeInputBox('coin','isInput')" v-if="computeInputBox('coin','show')">
						<el-select v-model="ruleForm.coin" placeholder="请选择" :size="size" clearable class="lz-el-select"
							:disabled="computeInputBox('coin','disabled')">
							<el-option v-for="item in coinList" :key="item.id" :label="item.coinName"
								:value="item.coinNo"></el-option>
						</el-select>
					</el-form-item>
					<el-form-item name="税率" :label="computeInputBox('taxCode','label')"
						:prop="computeInputBox('taxCode','isInput')" v-if="computeInputBox('taxCode','show')">
						<el-select v-model="ruleForm.taxCode" placeholder="请选择" :size="size" clearable
							class="lz-el-select" :disabled="computeInputBox('taxCode','disabled')">
							<el-option v-for="item in taxCodeList" :key="item.id" :label="item.taxName"
								:value="item.taxNo"></el-option>
						</el-select>
					</el-form-item>
				</el-col>
				<el-col :span="8">
					<el-form-item name="开票公司" :label="computeInputBox('invoiceCompany','label')"
						:prop="computeInputBox('invoiceCompany','isInput')" v-if="computeInputBox('invoiceCompany','show')">
						<el-select v-model="ruleForm.invoiceCompany" placeholder="请选择" :size="size" clearable
							class="lz-el-select" :disabled="computeInputBox('invoiceCompany','disabled')">
							<el-option v-for="item in invoiceCompanyList" :key="item.id" :label="item.companyName"
								:value="item.companyNo"></el-option>
						</el-select>
					</el-form-item>
					<el-form-item name="账号号码" :label="computeInputBox('accountNo','label')"
						:prop="computeInputBox('accountNo','isInput')" v-if="computeInputBox('accountNo','show')">
						<el-input class="lz-el-input" v-model="ruleForm.accountNo"
							:disabled="computeInputBox('accountNo','disabled')" :size="size" :maxlength="30"></el-input>
					</el-form-item>
					<el-form-item name="开户行" :label="computeInputBox('bankName','label')"
						:prop="computeInputBox('bankName','isInput')" v-if="computeInputBox('bankName','show')">
						<el-input class="lz-el-input" v-model="ruleForm.bankName"
							:disabled="computeInputBox('bankName','disabled')" :size="size" :maxlength="50"></el-input>
					</el-form-item>
				</el-col>

				<el-col :span="8">
					<el-form-item name="财务负责人" :label="computeInputBox('financeContact','label')"
						:prop="computeInputBox('financeContact','isInput')"
						v-if="computeInputBox('financeContact','show')">
						<el-input class="lz-el-input" v-model="ruleForm.financeContact"
							:disabled="computeInputBox('financeContact','disabled')" :size="size" :maxlength="20"></el-input>
					</el-form-item>
					<el-form-item name="财务联系电话" :label="computeInputBox('financePhone','label')"
						:prop="computeInputBox('financePhone','isInput','checkLandline')" v-if="computeInputBox('financePhone','show')">
						<el-input class="lz-el-input" v-model="ruleForm.financePhone"
							:disabled="computeInputBox('financePhone','disabled')" :size="size" :maxlength="20"></el-input>
					</el-form-item>
					<el-form-item name="财务邮箱地址" :label="computeInputBox('financeEmail','label')"
						:prop="computeInputBox('financeEmail','isInput','checkEmail')" v-if="computeInputBox('financeEmail','show')">
						<el-input class="lz-el-input" v-model="ruleForm.financeEmail"
							:disabled="computeInputBox('financeEmail','disabled')" :size="size" :maxlength="20"></el-input>
					</el-form-item>
				</el-col>
			</el-row>
			<el-row>
				<el-col :span="16">
					<el-form-item name="备注" :label="computeInputBox('note','label')"
						:prop="computeInputBox('note','isInput')" v-if="computeInputBox('note','show')">
						<el-input v-model="ruleForm.note" :disabled="computeInputBox('note','disabled')" :size="size" :maxlength="255">
						</el-input>
					</el-form-item>
				</el-col>
			</el-row>
		</el-form>
		<el-divider content-position="left">
			<el-link type="primary">相关资料上传</el-link>
		</el-divider>
		<div class="upload">
			<div class="title">营业执照：</div>
			<fileUpload ref="fileUpload1" @fileUploadData="fileUploadData($event,'营业执照')"></fileUpload>
		</div>
		<div class="upload">
			<div class="title">开票资料：</div>
			<fileUpload2 ref="fileUpload2" @fileUploadData="fileUploadData($event,'开票资料')"></fileUpload2>
		</div>
		<div class="upload">
			<div class="title">其他资料：</div>
			<fileUpload3 ref="fileUpload3" @fileUploadData="fileUploadData($event,'其他资料')"></fileUpload3>
		</div>

		<!-- 供应商列表-->
		<SupplierNumber @submit="bindConfiguration" ref="SupplierNumber"></SupplierNumber>

	</div>
</template>

<script>
	let that
	import {
		mapGetters
	} from 'vuex'
	import fileUpload from '@/components/fileUpload/fileUpload'
	import fileUpload2 from '@/components/fileUpload2/fileUpload'
	import fileUpload3 from '@/components/fileUpload3/fileUpload'
	// 供应商列表
	import SupplierNumber from '@/components/SupplierNumber/SupplierNumber'
	export default {
		components: {
			SupplierNumber,
			fileUpload,
			fileUpload2,
			fileUpload3,
		},
		name: 'addCustomer',
		props: {
			type: {
				type: String,
				default: () => {
					return ''
				}
			},
		},
		computed: {
			//InputBoxList输入框的配置
			...mapGetters(['size', 'themeBtColor', 'api', 'InputBoxList']),
			//计算出当前输入框配置信息
			computeInputBox() {
				return (field, type,prop='') => {
					let arr = this.InputBoxList.find(item => item.fieldName == field)
					if (arr && type == 'show') {
						return arr.isVisible == 0 ? true : false //0为显示1为隐藏
					}
					if (arr && type == 'isInput') {
						if (arr.isInput != 0 && this.rules[field]) { //0为必填1为不必填
							this.rules[field][0].required = false
						}
						return field
					}
					if (arr && type == 'disabled') {
						return arr.isDisplay == 0 ? true : false //0为只读1为可读写
					}
					if (arr && type == 'label') {
						return arr.fieldLabel //标签动态显示名称
					}
					return false
				}
			}
		},
		data() {
			return {
				dialog: {
					show: false,
					selectItem: '', //已选择的
					seach: {
						supplierNo: '', //供应商编号
						supplierEname: '', //供应商名称
					},
					list: [],
					page: {
						pageNum: 1, //当前页数
						pageSize: 10, //默认一页展示10条
						total: 0, //总条数
					}
				},
				companykindList: [{ //公司性质
						value: '1',
						label: '一般纳税人'
					},
					{
						value: '2',
						label: '小规模纳税人'
					},
					{
						value: '3',
						label: '个体户'
					},
					{
						value: '4',
						label: '外币公司'
					},
					{
						value: '5',
						label: '三来一补'
					}
				],
				saleNoFormatList: [], //出货单格式列表
				quotationNoFormatList: [], //报价单格式列表
				settleNoList: [], //结算类型列表
				paymentNoList: [], //付款类型列表
				coinList: [], //币别列表
				taxCodeList: [], //税率列表
				invoiceCompanyList: [], //开票列表
				supplierNoList: [{
					id: 1,
					label: 'caca',
					name: '李钊'
				}], //供应商列表
				ruleForm: {
					customerNo: '', //客户编号
					customerCname: '', //客户简称
					customerEname: '', //客户全称
					manageRange: '', //经营范围
					address: '', //客户地址
					companyKind: '', //公司性质
					companyTax: '', //公司税码
					registerMoney: '', //注册资金
					firstContactName: '', //第一联系人
					firstPhone: '', //移动号码
					email: '', //邮箱Email
					//送货及报价
					supplierNo: '', //供应商编号
					shippingAddress: '', //送货地址
					quotationNoFormat: '', //报价单格式
					quotationBeginNo: '', //报价单单号
					saleNoFormat: '', //出货单格式
					saleBusinessBeginNo: '', //销售出货号
					littleBusinessBeginNo: '', //零星出货号
					//财务资料
					invoiceCompany: '', //开票抬头
					accountNo: '', //账号号码
					bankName: '', //开户银行
					note: '', //备注
					settleNo: '', //结算类型编号
					paymentNo: '', //付款类型编号
					coin: '', //币别	
					taxCode: '', //税率
					financeContact: '', //财务负责人
					financePhone: '', //财务联系电话
					financeEmail: '', //财务邮箱地址
					//材料上传
					imgBusinessLicense: '', //营业执照
					imgInvoice: '', //开票材料
					imgOther: '', //其他材料
				},
				rules: {
					financePhone:[{
							required: true,
							message: '必填项',
							trigger: 'blur'
						},
						{
							validator: this.$lizhao.test.checkLandlineAndMobile,
							trigger: 'change'
						}
					],
					financeEmail: [{
							required: true,
							message: '必填项',
							trigger: 'blur'
						},
						{
							validator: this.$lizhao.test.checkEmail,
							trigger: 'change'
						}
					],
					customerNo: [{
						required: true,
						message: '必填项',
						trigger: 'blur'
					}],
					customerCname: [{
						required: true,
						message: '必填项',
						trigger: 'blur'
					}],
					customerEname: [{
						required: true,
						message: '必填项',
						trigger: 'blur'
					}],
					manageRange: [{
						required: true,
						message: '必填项',
						trigger: 'blur'
					}],
					address: [{
						required: true,
						message: '必填项',
						trigger: 'blur'
					}],
					companyKind: [{
						required: true,
						message: '必填项',
						trigger: 'blur'
					}],
					companyTax: [{
						required: true,
						message: '必填项',
						trigger: 'blur'
					}],
					taxcode: [{
						required: true,
						message: '必填项',
						trigger: 'blur'
					}],
					registerMoney: [{
						required: true,
						message: '必填项',
						trigger: 'blur'
					}],
					firstContactName: [{
						required: true,
						message: '必填项',
						trigger: 'blur'
					}],
					firstPhone: [{
						required: true,
						message: '必填项',
						trigger: 'blur'
					},
					{
						validator: this.$lizhao.test.checkLandlineAndMobile,
						trigger: 'change'
					}],
					tel: [{
						required: true,
						message: '必填项',
						trigger: 'blur'
					}],
					email: [{
						required: true,
						message: '必填项',
						trigger: 'blur'
					},
					{
						validator: this.$lizhao.test.checkEmail,
						trigger: 'change'
					}],
					supplierNo: [{
						required: true,
						message: '必填项',
						trigger: 'blur'
					}],
					invoiceCompany: [{
						required: true,
						message: '必填项',
						trigger: 'blur'
					}],
					shippingAddress: [{
						required: true,
						message: '必填项',
						trigger: 'blur'
					}],
					quotationNoFormat: [{
						required: true,
						message: '必填项',
						trigger: 'blur'
					}],
					quotationBeginNo: [{
						required: true,
						message: '必填项',
						trigger: 'blur'
					}],
					saleNoFormat: [{
						required: true,
						message: '必填项',
						trigger: 'blur'
					}],
					saleBusinessBeginNo: [{
						required: true,
						message: '必填项',
						trigger: 'blur'
					}],
					littleBusinessBeginNo: [{
						required: true,
						message: '必填项',
						trigger: 'blur'
					}],
				}
			}
		},
		mounted() {
			that = this
			//获取结算方式字典
			that.settlement_list()
			//付款类型列表
			that.payment_list()
			//税率列表
			that.tax_list()
			//单据格式
			that.printFormat_list()
			//获取币别
			that.coin_list()
			//获取公司代码
			that.company_list()
			
		},
		methods: {
			//获取公司代码
			company_list(){
				that.GLOBAL.doGet(that.api.GLOBAL_setting_company_list, {}, function(res) {
					if (res.code == 200) {
						that.invoiceCompanyList = res.result
					}
				});
			},
			//获取币别
			coin_list() {
				that.GLOBAL.doGet(that.api.GLOBAL_setting_coin_list, {}, function(res) {
					if (res.code == 200) {
						that.coinList = res.result
					}
				});
			},
			//单据格式
			printFormat_list() {
				that.GLOBAL.doGet(that.api.GLOBAL_setting_printFormat_list, {}, function(res) {
					if (res.code == 200) {
						that.quotationNoFormatList = res.result
						that.saleNoFormatList = res.result
					}
				});
			},
			//税率列表
			tax_list() {
				that.GLOBAL.doGet(that.api.GLOBAL_setting_tax_list, {}, function(res) {
					if (res.code == 200) {
						that.taxCodeList = res.result
					}
				});
			},
			//获取结算方式字典
			settlement_list() {
				that.GLOBAL.doGet(that.api.GLOBAL_setting_settlement_list, {}, function(res) {
					if (res.code == 200) {
						that.settleNoList = res.result
					}
				});
			},
			//获取结算方式字典
			payment_list() {
				that.GLOBAL.doGet(that.api.GLOBAL_setting_payment_list, {}, function(res) {
					if (res.code == 200) {
						that.paymentNoList = res.result
					}
				});
			},
			//获取到光标
			focusFn() {
				that.$refs.SupplierNumber.focusFn()
			},
			//弹框确定
			bindConfiguration(item) {
				that.ruleForm.supplierNo = item.supplierNo
				that.ruleForm.supplierCname = item.supplierCname
			},

			//点击查看或修改
			SeeRuleForm(row, text) {
				that.ruleForm = JSON.parse(JSON.stringify(row))
				that.$refs.fileUpload1.seeImage(that.ruleForm.imgBusinessLicense, text) //营业执照
				that.$refs.fileUpload2.seeImage(that.ruleForm.imgInvoice, text) //开票资料
				that.$refs.fileUpload3.seeImage(that.ruleForm.imgOther, text) //其它资料
			},
			//点击添加弹框确定
			determine() {
				that.$refs.ruleForm.validate((valid) => {
					if (valid) {
						let req = {
							...that.ruleForm
						}
						that.GLOBAL.doPost(that.api.GLOBAL_masterData_customer_add, req, function(res) {
							if (res.code == 200) {
								that.$message.success(res.message)
								that.$emit('success', true)
							}
						});
					} else {
						console.log('error submit!!');
						return false;
					}
				})
			},
			//客户编辑
			customer_edit() {
				that.$refs.ruleForm.validate((valid) => {
					if (valid) {
						let req = {
							...that.ruleForm
						}
						that.GLOBAL.doPost(that.api.GLOBAL_masterData_customer_edit, req, function(res) {
							if (res.code == 200) {
								that.$message.success(res.message)
								that.$emit('success', true)
							}
						});
					} else {
						console.log('error submit!!');
						return false;
					}
				})
			},
			//营业执照上传完成
			fileUploadData(data, text) {
				if (data.fileList&&data.fileList.length>0) {
					let req = {
						url: data.fileList[0].url,
						name: data.fileList[0].name,
						uid: data.fileList[0].uid,
						type: data.fileList[0].raw.type,
						size: data.fileList[0].raw.size,
					}
					console.log(text);
					if (text == '营业执照') {
						that.ruleForm.imgBusinessLicense = JSON.stringify(req)
					} else if (text == '开票资料') {
						that.ruleForm.imgInvoice = JSON.stringify(req)
					} else if (text == '其他资料') {
						that.ruleForm.imgOther = JSON.stringify(req)
					}
				}else{
					if (text == '营业执照') {
						that.ruleForm.imgBusinessLicense = ''
					} else if (text == '开票资料') {
						that.ruleForm.imgInvoice = ''
					} else if (text == '其他资料') {
						that.ruleForm.imgOther = ''
					}
				}
			},
			//重置
			Reset() {
				that.ruleForm = {
					customerNo: '', //客户编号
					customerCname: '', //客户简称
					customerEname: '', //客户全称
					manageRange: '', //经营范围
					address: '', //客户地址
					companyKind: '', //公司性质
					companyTax: '', //公司税码
					registerMoney: '', //注册资金
					firstContactName: '', //第一联系人
					firstPhone: '', //移动号码
					email: '', //邮箱Email
					//送货及报价
					supplierNo: '', //供应商编号
					shippingAddress: '', //送货地址
					quotationNoFormat: '', //报价单格式
					quotationBeginNo: '', //报价单单号
					saleNoFormat: '', //出货单格式
					saleBusinessBeginNo: '', //销售出货号
					littleBusinessBeginNo: '', //零星出货号
					//财务资料
					invoiceCompany: '', //开票抬头
					accountNo: '', //账号号码
					bankName: '', //开户银行
					note: '', //备注
					settleNo: '', //结算类型编号
					paymentNo: '', //付款类型编号
					coin: '', //币别	
					taxCode: '', //税率
					financeContact: '', //财务负责人
					financePhone: '', //财务联系电话
					financeEmail: '', //财务邮箱地址
					//材料上传
					imgBusinessLicense: '', //营业执照
					imgInvoice: '', //开票材料
					imgOther: '', //其他材料
				}
				this.$refs.ruleForm.resetFields();
			}
		}

	}
</script>

<style lang="scss" scoped>
	.addCustomer {
		.upload {
			display: flex;
			width: 100%;
			margin-bottom: 20px;
			box-sizing: border-box;

			.title {
				font-size: 14px;
				padding: 0 5px;
				padding: 5px;
				width: 100px;
			}
		}
	}
</style>
